package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.RecruitChannel;
import com.wn55.hrms.mapper.RecruitChannelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.bai~
 * @version 1.0
 * @date 2022/4/28 11:51
 */
@Service
public class RecruitChannelService {

    @Autowired
    RecruitChannelMapper recruitChannelMapper;

    public PageInfo<RecruitChannel> queryChannel(Integer now, Integer size, String channelName, String channelType) {
        PageHelper.startPage(now,size);

       List<RecruitChannel> list =  recruitChannelMapper.selectChannelByConds(channelName,channelType);
       return new PageInfo<>(list);
    }

    public void removeBykey(int id) {
        recruitChannelMapper.deleteByPrimaryKey(id);
    }

    public void addChannel(RecruitChannel recruitChannel) {
        recruitChannelMapper.insertChannel(recruitChannel);
    }

    public void modify(RecruitChannel recruitChannel) {
         recruitChannelMapper.updateChannel(recruitChannel);
    }
}
